Class

Panel (SUI)

 

A container for other types of controls, with an optional frame.

A panel can specify layout options for its child elements. Hiding a panel hides all its children. Making it visible makes visible those children that are not individually hidden.

QuickLinks

add, addEventListener, dispatchEvent, hide, onDraw, remove, removeEventListener, show

Hierarchy

Object
Panel (SUI)

Properties

PropertyTypeAccessDescription
alignChildrenString r/wSpecifies how to align the child elements.
alignmentString r/w The alignment style for this element. If defined, this value overrides the alignChildren setting for the parent container.
This can be a single string, which indicates the alignment for the orientation specified in the parent container, or an array of two strings, indicating both the horizontal and vertical alignment (in that order). Allowed values depend on the orientation value of the parent container. They are not case sensitive.
•  For orientation=row:top, bottom, fill
•  For orientation=column: left, right, fill
•  For orientation=stack:top, bottom, left, right, fill
boundsBounds r/wThe boundaries of the element, in parent-relative coordinates.
Setting an element's size or location changes its bounds property, and vice-versa.
charactersNumber (min: 0) r/w Reserve space for the specified number of characters; affects calculation of preferredSize .
childrenArray of Object readonlyAn array of child elements.
enabledBoolean r/wTrue if this element is enabled.
An enabled element can accept input, according to its type. When false, control elements do not accept input, and all types of elements have a dimmed appearance.
graphicsScriptUIGraphics readonly The graphics object that can be used to customize the element's appearance, in response to the onDraw() event.
helpTipString r/wThe help text that is displayed when the mouse hovers over the element.
indentNumber (min: 0) r/wThe number of pixels to indent the element during automatic layout.
Applies for column orientation and left alignment, or row orientation and top alignment.
justifyString r/wThe default text justification style for child text elements. (default: left)
One of left, center, or right. Justification only works if this value is set on creation of the element.
layoutLayoutManager r/wThe layout manager for this container.
The first time a container object is made visible, ScriptUI invokes this layout manager by calling its layout() function. Default is an instance of the LayoutManager class that is automatically created when the container element is created.
locationPoint r/wThe upper left corner of this element's frame relative to its parent.
The location is defined as [bounds.x, bounds.y]. Setting an element's location changes its bounds property, and vice-versa.
marginsNumber r/wThe number of pixels between the edges of a container and the outermost child elements.
You can specify different margins for each edge of the container. The default value is based on the type of container, and is chosen to match the standard Adobe UI guidelines.
maximumSizeDimension r/w The maximum height and width to which the element can be resized.
minimumSizeDimension r/w The minimum height and width to which the element can be resized.
orientationString r/wThe layout orientation of children in a container.
Interpreted by the layout manager for the container. The default LayoutManager Object accepts the (case-insensitive) values row, column, or stack. For window and panel, the default is column, and for group the default is row. The allowed values for the container's alignChildren and its children's alignment properties depend on the orientation.
parentObject readonlyThe parent element.
preferredSizeDimension r/wThe preferred size, used by layout managers to determine the best size for each element.
If not explicitly set by a script, value is established by the UI framework in which ScriptUI is employed, and is based on such attributes of the element as its text, font, font size, icon size, and other UI framework-specific attributes.A script can explicitly set this value before the layout manager is invoked in order to establish an element size other than the default.
propertiesObject r/wAn object that contains one or more creation properties of the control (properties used only when the element is created).
Creation properties of a Panel object can include:
•  borderStyle: A string that specifies the appearance of the border drawn around the panel. One of black, etched, gray, raised, sunken. Default is etched.
•  su1PanelCoordinates: Photoshop only. When true, this panel automatically adjusts the positions of its children for compatability with Photoshop CS. Default is false, meaning that the panel does not adjust the positions of its children, even if the parent window has automatic adjustment enabled.
sizeDimension r/wThe current dimensions of this element.
Initially undefined, and unless explicitly set by a script, it is defined by a LayoutManager . A script can explicitly set size before the layout manager is invoked to establish an element size other than the preferredSize or the default size, but this is not recommended. Defined as [bounds.width, bounds.height]. Setting an element's size changes its bounds property, and vice-versa.
spacingNumber r/wThe number of pixels separating one child element from its adjacent sibling element.
Because each container holds only a single row or column of children, only a single spacing value is needed for a container. The default value is based on the type of container, and is chosen to match standard Adobe UI guidelines.
textString r/wThe title or label text, a localizable string.
typeString readonlyThe element type; "panel".
visibleBoolean r/wTrue if this element is shown, false if it is hidden.
When a container is hidden, its children are also hidden, but they retain their own visibility values, and are shown or hidden accordingly when the parent is next shown.
windowWindow (SUI) readonlyThe window that this element belongs to.
windowBoundsBounds readonlyThe bounds of this element relative to the top-level parent window.

Methods

Events

void onDraw ()
An event-handler callback function, called when the panel is about to be drawn.
Allows the script to modify or control the appearance, using the control's associated ScriptUIGraphics object. Handler takes one argument, a DrawState object.

Instances

Object add (type: String[, bounds: Bounds][, text: String][, properties: Object])
Adds a child element to this container.
Creates and returns a new control or container object and adds it to the children of this group.
ParameterTypeDescription
typeString The type of the child element, as specified for the type property.
Control types are listed in the JavaScript Tools Guide.
boundsBoundsA bounds specification that describes the size and position of the new control or container, relative to its parent.
If supplied, this value creates a new Bounds object which is assigned to the new object's bounds property. (Optional)
textStringThe text or label, a localizable string.
Initial text to be displayed in the control as the title, label, or contents, depending on the control type. If supplied, this value is assigned to the new object's text property. (Optional)
propertiesObjectAn object that contains one or more creation properties of the new child (properties used only when the element is created).
The creation properties depend on the element type. See
property of each control type. (Optional)

Boolean addEventListener (eventName: String, handler: Function[, capturePhase: Boolean=false])
Registers an event handler for a particular type of event occuring in this element.
ParameterTypeDescription
eventNameStringThe name of the event.
Event names are listed in the JavaScript Tools Guide.
handlerFunctionThe function that handles the event.
This can be the name of a function defined in the extension, or a locally defined handler function to be executed when the event occurs. A handler function takes one argument, the UIEvent object.
capturePhaseBooleanWhen true, the handler is called only in the capturing phase of the event propagation. (default: false)
Default is false, meaning that the handler is called in the bubbling phase if this object is an ancestor of the target, or in the at-target phase if this object is itself the target.

Event dispatchEvent ()
Simulates the occurrence of an event in this target.
A script can create a UIEvent object for a specific event and pass it to this method to start the event propagation for the event.

void hide ()
Hides this element.

void remove (what: Any)
Removes the specified child control from this group's children array.
No error results if the child does not exist.
ParameterTypeDescription
whatAny The child control to remove, specified by 0-based index, text property value, or as a control object.

Boolean removeEventListener (eventName: String, handler: Function[, capturePhase: Boolean=false])
Unregisters an event handler for a particular type of event occuring in this element.
All arguments must be identical to those that were used to register the event handler.
ParameterTypeDescription
eventNameStringThe name of the event.
handlerFunctionThe function that handles the event.
capturePhaseBooleanWhether to call the handler only in the capturing phase of the event propagation. (default: false)

void show ()
Shows this element.
When a window or container is hidden, its children are also hidden, but when it is shown again, the children retain their own visibility states.

Jongware, 25-Nov-2012 v3.0.3iContents :: Index